package com.yanqu.road.web.controller.game.sort;

import com.yanqu.road.entity.player.UserInfo;

import java.util.Comparator;

public class UserInfoVipSort implements Comparator<UserInfo> {

    private String orderBy = "asc";

    public UserInfoVipSort() {
    }

    public UserInfoVipSort(String orderBy) {
        this.orderBy = orderBy;
    }

    @Override
    public int compare(UserInfo o1, UserInfo o2) {
        if("asc".equals(orderBy)){
            return Long.compare(o1.getVipExp(), o2.getVipExp());
        }
        return Long.compare(o2.getVipExp(), o1.getVipExp());
    }
}
